// ==UserScript==
// @name           Submit friends list to MN:SL
// @namespace      http://marvulous.co.uk/export-friends-list/
// @description    Submit friends list to MN:SL
// @include        *secondlife.com/community/friends.php*
// @exclude        *secondlife.com/community/friends.php*view=photos*
// ==/UserScript==
var friendstable = document.getElementsByTagName('table')[5];
var friendslist = friendstable.getElementsByTagName('li');
var loop = friendslist.length;
var friends_text = '';
for(x=0;x<loop;++x)
{
	if(friendslist[x].getElementsByTagName('a').length == 0)
	{
		friends_text += friendslist[x].innerHTML + ",";
	}
	else
	{
		friends_text += friendslist[x].getElementsByTagName('a')[0].text + ",";
	}
}
friendstable.getElementsByTagName('tr')[1].getElementsByTagName('td')[1].innerHTML = '<form method="post" action="http://svc.sl.net.marvulous.co.uk/submit-friends-list.php"><input type="hidden" name="friends_csv" value="' + friends_text + '0-034777f434&**(*$" /><input type="hidden" name="Resident" value="' + document.getElementsByTagName('strong')[0].innerHTML + '" /><input type="submit" value="Submit Friends List to MN:SL" /></form>' + friendstable.getElementsByTagName('tr')[1].getElementsByTagName('td')[1].innerHTML;